home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / netFDDI.h,v < prev    next >
Encoding:
Text File  |  1992-06-05  |  9.3 KB  |  407 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.6
  10. date     92.06.05.12.33.43;  author voelker;  state Exp;
  11. branches ;
  12. next     1.5;
  13.  
  14. 1.5
  15. date     92.03.27.16.11.01;  author voelker;  state Exp;
  16. branches ;
  17. next     1.4;
  18.  
  19. 1.4
  20. date     92.03.04.16.31.05;  author jhh;  state Exp;
  21. branches ;
  22. next     1.3;
  23.  
  24. 1.3
  25. date     92.02.27.18.10.07;  author voelker;  state Exp;
  26. branches ;
  27. next     1.2;
  28.  
  29. 1.2
  30. date     92.02.27.18.09.11;  author voelker;  state Exp;
  31. branches ;
  32. next     1.1;
  33.  
  34. 1.1
  35. date     92.01.09.14.46.20;  author voelker;  state Exp;
  36. branches ;
  37. next     ;
  38.  
  39.  
  40. desc
  41. @definition of FDDI address and packet...started from netEther.h
  42. @
  43.  
  44.  
  45. 1.6
  46. log
  47. @fddi support
  48. @
  49. text
  50. @/*
  51.  * netFDDI.h --
  52.  *
  53.  *    This defines the format of an FDDI packet.
  54.  *
  55.  * Copyright 1992 Regents of the University of California
  56.  * Permission to use, copy, modify, and distribute this
  57.  * software and its documentation for any purpose and without
  58.  * fee is hereby granted, provided that the above copyright
  59.  * notice appear in all copies.  The University of California
  60.  * makes no representations about the suitability of this
  61.  * software for any purpose.  It is provided "as is" without
  62.  * express or implied warranty.
  63.  *
  64.  *
  65.  * $Header: /sprite/src/lib/include/RCS/netFDDI.h,v 1.5 92/03/27 16:11:01 voelker Exp Locker: voelker $
  66.  */
  67.  
  68. #ifndef _NETFDDI
  69. #define _NETFDDI
  70.  
  71.  
  72. #include "machparam.h"
  73.  
  74. /*
  75.  * Compare two FDDI addresses.
  76.  */
  77.  
  78. #define    Net_FDDIAddrCmp(e1,e2) Net_FDDIAddrCmpPtr(&e1,&e2)
  79.  
  80. /*
  81.  * Compare bytes backward because FDDI addresses tend to start with the
  82.  * same few bytes.
  83.  */
  84.  
  85. #define    Net_FDDIAddrCmpPtr(e1,e2) \
  86.    (!(((e1)->byte6 == (e2)->byte6) && ((e1)->byte5 == (e2)->byte5) && \
  87.     ((e1)->byte4 == (e2)->byte4) && ((e1)->byte3 == (e2)->byte3) && \
  88.     ((e1)->byte2 == (e2)->byte2) && ((e1)->byte1 == (e2)->byte1)))
  89.  
  90. /*
  91.  * FDDI Address - 6 bytes
  92.  */
  93.  
  94. typedef struct {
  95.     unsigned char byte1;
  96.     unsigned char byte2;
  97.     unsigned char byte3;
  98.     unsigned char byte4;
  99.     unsigned char byte5;
  100.     unsigned char byte6;
  101. } Net_FDDIAddress;
  102.  
  103. #define    NET_FDDI_ADDR_BYTE1(e)    ((e).byte1)
  104. #define    NET_FDDI_ADDR_BYTE2(e)    ((e).byte2)
  105. #define    NET_FDDI_ADDR_BYTE3(e)    ((e).byte3)
  106. #define    NET_FDDI_ADDR_BYTE4(e)    ((e).byte4)
  107. #define    NET_FDDI_ADDR_BYTE5(e)    ((e).byte5)
  108. #define    NET_FDDI_ADDR_BYTE6(e)    ((e).byte6)
  109.  
  110. #ifdef sun4
  111. #define    NET_FDDI_ADDR_COPY(src,dst)    \
  112.     ((dst).byte1 = (src).byte1);    \
  113.     ((dst).byte2 = (src).byte2);    \
  114.     ((dst).byte3 = (src).byte3);    \
  115.     ((dst).byte4 = (src).byte4);    \
  116.     ((dst).byte5 = (src).byte5);    \
  117.     ((dst).byte6 = (src).byte6)
  118. #else
  119. #define    NET_FDDI_ADDR_COPY(src,dst) ((dst) = (src))
  120. #endif
  121.  
  122. /*
  123.  * FDDI Header - 16 bytes 
  124.  */
  125.  
  126. typedef struct Net_FDDIHdr {
  127.     unsigned char   prh[3];        /* Packet request headers */
  128.     unsigned char   frameControl;  /* Frame control byte */
  129.     Net_FDDIAddress dest;          /* Destination Address of packet */
  130.     Net_FDDIAddress source;        /* Source Address of packet */
  131. } Net_FDDIHdr;
  132.  
  133. #define    NET_FDDI_HDR_DESTINATION(e)    ((e).destination)
  134. #define    NET_FDDI_HDR_SOURCE(e)        ((e).source)
  135. #define    NET_FDDI_HDR_TYPE(e)        ((e).type)
  136.  
  137. #define    NET_FDDI_HDR_DESTINATION_PTR(e)    &((e).destination)
  138. #define    NET_FDDI_HDR_SOURCE_PTR(e)    &((e).source)
  139. #define    NET_FDDI_HDR_TYPE_PTR(e)    &((e).type)
  140.  
  141. #define    NET_FDDI_HDR_COPY(src, dst) ((dst) = (src))
  142.  
  143. /*
  144.  * The docs say that the minimum for an LLC packet is 20.
  145.  */
  146. #define    NET_FDDI_MIN_BYTES    20
  147. #define    NET_FDDI_MAX_BYTES    4480
  148.  
  149. /*
  150.  * This value is used to distinguish Sprite FDDI packets from other
  151.  * FDDI packets on the same ring.  This right here is a major kludge
  152.  * until we can get the Data Link Specification.  This actually is an LLC
  153.  * of priority 3 frame control, but oh well.  We should be using the Data
  154.  * Link Specs, but we never got ahold of them.
  155.  *
  156.  * This value is placed in the header of each packet in 
  157.  * netRoute.c:Net_InstallRoute().
  158.  *
  159.  * FDDI packets are checked for this value in netDFRecv.c:GotAPacket().
  160.  */
  161.  
  162. #define NET_FDDI_SPRITE                 0x53
  163.  
  164. /*
  165.  * Definitions of known Ethernet packet types (from rfc990, except for SPRITE
  166.  * and TRAIL).
  167.  *
  168.  * These mean nothing to the FDDI driver until encapsulated ethernet
  169.  * is attempted.
  170.  */
  171. #define NET_FDDI_PUP            0x0200
  172. #define NET_FDDI_PUP_ADDR_TRANS        0x0201
  173. #define NET_FDDI_XNS_IDP        0x0600
  174. #define NET_FDDI_IP            0x0800
  175. #define NET_FDDI_ARP            0x0806
  176. #define NET_FDDI_XNS_COMPAT        0x0807
  177. /* #define NET_FDDI_SPRITE        0x0500 */
  178. #define NET_FDDI_SPRITE_ARP        0x0502 /* deprecated */
  179. #define NET_FDDI_SPRITE_DEBUG        0x0504
  180. #define NET_FDDI_TRAIL            0x1000
  181. #define NET_FDDI_REVARP            0x8035
  182. #define NET_FDDI_MOP            0x6001
  183.  
  184. #endif /* _NETFDDI */
  185.  
  186.  
  187.  
  188.  
  189. @
  190.  
  191.  
  192. 1.5
  193. log
  194. @updated to fit in with the new net stuff, and changed the polarity of
  195. Net_FDDIAddrCmp[Ptr]...
  196.  
  197. @
  198. text
  199. @a5 10
  200.  *    
  201.  *     The symbol NET_ETHER_BAD_ALIGNMENT must defined for machines that
  202.  *    pad or otherwise mess up the layout of the Net_EtherHdr structure.
  203.  *    This must be defined for machines such as the SPUR where structures
  204.  *    are padded to 4 byte boundries.  To test a machine to see if 
  205.  *    NET_ETHER_BAD_ALIGNMENT is needed, check sizeof(Net_EtherHdr).  If
  206.  *    this number is anything other than the size of an ethernet header 
  207.  *    (14 bytes), NET_ETHER_BAD_ALIGNMENT must be defined in the 
  208.  *    machparam.h file for the machine.
  209.  *
  210. d16 1
  211. a16 1
  212.  * $Header: /sprite/src/lib/include/RCS/netFDDI.h,v 1.4 92/03/04 16:31:05 jhh Exp Locker: voelker $
  213. a24 1
  214. #ifdef NEW_NET
  215. a28 2
  216. #ifndef NET_FDDI_BAD_ALIGNMENT
  217.  
  218. a40 40
  219. #else     /* NET_FDDI_BAD_ALIGNMENT */
  220.  
  221.  
  222. #define    Net_FDDIAddrCmp(e1,e2) (bcmp((e1),(e2), sizeof(Net_FDDIAddress)))
  223.  
  224. #define    Net_FDDIAddrCmpPtr(e1Ptr,e2Ptr) Net_FDDIAddrCmp(*(e1Ptr),*(e2Ptr))
  225.  
  226. #endif /* NET_FDDI_BAD_ALIGNMENT */
  227.  
  228. #else /* NEW_NET */
  229.  
  230. /*
  231.  * Compare two FDDI addresses.
  232.  */
  233.  
  234. #ifndef NET_FDDI_BAD_ALIGNMENT
  235.  
  236. #define    NET_FDDI_COMPARE(e1,e2) NET_FDDI_COMPARE_PTR(&e1,&e2)
  237.  
  238. /*
  239.  * Compare bytes backward because FDDI addresses tend to start with the
  240.  * same few bytes.
  241.  */
  242.  
  243. #define    NET_FDDI_COMPARE_PTR(e1,e2) \
  244.    (((e1)->byte6 == (e2)->byte6) && ((e1)->byte5 == (e2)->byte5) && \
  245.     ((e1)->byte4 == (e2)->byte4) && ((e1)->byte3 == (e2)->byte3) && \
  246.     ((e1)->byte2 == (e2)->byte2) && ((e1)->byte1 == (e2)->byte1))
  247.  
  248. #else     /* NET_FDDI_BAD_ALIGNMENT */
  249.  
  250.  
  251. #define    NET_FDDI_COMPARE(e1,e2) (bcmp((e1),(e2), sizeof(Net_FDDIAddress))==0)
  252.  
  253. #define    NET_FDDI_COMPARE_PTR(e1Ptr,e2Ptr) NET_FDDI_COMPARE(*(e1Ptr),*(e2Ptr))
  254.  
  255. #endif /* NET_FDDI_BAD_ALIGNMENT */
  256.  
  257. #endif /* NEW_NET */
  258.  
  259. d42 1
  260. a42 1
  261.  * Ethernet Address - 6 bytes
  262. a43 1
  263. #ifndef NET_FDDI_BAD_ALIGNMENT
  264. d73 2
  265. a74 18
  266. #else 
  267.  
  268. typedef unsigned char Net_FDDIAddress[6];
  269.  
  270. #define    NET_FDDI_ADDR_BYTE1(e)    ((e)[0])
  271. #define    NET_FDDI_ADDR_BYTE2(e)    ((e)[1])
  272. #define    NET_FDDI_ADDR_BYTE3(e)    ((e)[2])
  273. #define    NET_FDDI_ADDR_BYTE4(e)    ((e)[3])
  274. #define    NET_FDDI_ADDR_BYTE5(e)    ((e)[4])
  275. #define    NET_FDDI_ADDR_BYTE6(e)    ((e)[5])
  276.  
  277. #define    NET_FDDI_ADDR_COPY(src,dst) \
  278.             (bcopy((src),(dst),sizeof(Net_FDDIAddress)))
  279.  
  280. #endif /* NET_FDDI_BAD_ALIGNMENT */
  281.  
  282. /*
  283.  * Ethernet Header.- 14 bytes 
  284. a76 2
  285. #ifndef NET_FDDI_BAD_ALIGNMENT
  286.  
  287. a93 16
  288. #else 
  289.  
  290. typedef unsigned char Net_FDDIHdr[14];
  291.  
  292. #define    NET_FDDI_HDR_DESTINATION(e)    ((unsigned char *) (e))
  293. #define    NET_FDDI_HDR_SOURCE(e)        ((unsigned char *) (e+6))
  294. #define    NET_FDDI_HDR_TYPE(e)        (*((unsigned short *) (e+12)))
  295.  
  296. #define    NET_FDDI_HDR_DESTINATION_PTR(e)    ((unsigned char *) (e))
  297. #define    NET_FDDI_HDR_SOURCE_PTR(e)    ((unsigned char *) (e+6))
  298. #define    NET_FDDI_HDR_TYPE_PTR(e)    (*((unsigned short *) (e+12)))
  299.  
  300. #define    NET_FDDI_HDR_COPY(src, dst) (bcopy(src,dst,sizeof(Net_FDDIHdr)))
  301.  
  302. #endif /* NET_FDDI_BAD_ALIGNMENT */
  303.  
  304. d101 10
  305. a110 3
  306.  * This right here is a major kludge until we can get the Data Link
  307.  * Specification.  This actually is an LLC of priority 3 frame control,
  308.  * but oh well.
  309. d112 1
  310. d118 3
  311. d123 1
  312. a123 1
  313. #define NET_FDDI_PUP_ADDR_TRANS    0x0201
  314. d132 1
  315. a132 1
  316. #define NET_FDDI_REVARP        0x8035
  317. @
  318.  
  319.  
  320. 1.4
  321. log
  322. @prettied up some of the identifiers
  323. @
  324. text
  325. @d26 1
  326. a26 1
  327.  * $Header: /sprite/src/lib/include/RCS/netFDDI.h,v 1.3 92/02/27 18:10:07 voelker Exp Locker: jhh $
  328. d50 1
  329. a50 1
  330.    (((e1)->byte6 == (e2)->byte6) && ((e1)->byte5 == (e2)->byte5) && \
  331. d52 1
  332. a52 1
  333.     ((e1)->byte2 == (e2)->byte2) && ((e1)->byte1 == (e2)->byte1))
  334. @
  335.  
  336.  
  337. 1.3
  338. log
  339. @definition of FDDI addresses and the FDDI header, plus macros
  340. to manipulate them
  341. @
  342. text
  343. @d26 1
  344. a26 1
  345.  * $Header: /sprite/src/lib/include/RCS/netFDDI.h,v 1.2 92/02/27 18:09:11 voelker Exp Locker: voelker $
  346. d42 1
  347. a42 1
  348. #define    Net_FddiAddrCmp(e1,e2) Net_FddiAddrCmpPtr(&e1,&e2)
  349. d49 1
  350. a49 1
  351. #define    Net_FddiAddrCmpPtr(e1,e2) \
  352. d57 1
  353. a57 1
  354. #define    Net_FddiAddrCmp(e1,e2) (bcmp((e1),(e2), sizeof(Net_FDDIAddress)))
  355. d59 1
  356. a59 1
  357. #define    Net_FddiAddrCmpPtr(e1Ptr,e2Ptr) Net_FddiAddrCmp(*(e1Ptr),*(e2Ptr))
  358. @
  359.  
  360.  
  361. 1.2
  362. log
  363. @*** empty log message ***
  364. @
  365. text
  366. @d26 1
  367. a26 1
  368.  * $Header: /sprite/src/lib/include/RCS/netFDDI.h,v 1.1 92/01/09 14:46:20 voelker Exp Locker: voelker $
  369. @
  370.  
  371.  
  372. 1.1
  373. log
  374. @Initial revision
  375. @
  376. text
  377. @d26 1
  378. a26 1
  379.  * $Header$
  380. d34 31
  381. d92 1
  382. a93 1
  383.  
  384. d149 5
  385. a153 4
  386. typedef struct {
  387.     Net_FDDIAddress destination;
  388.     Net_FDDIAddress source;
  389.     unsigned short   type;        /* valid types defined below */
  390. d183 1
  391. a183 3
  392.  * Minimum and maximum packet sizes. The maximum is actually 1518, but
  393.  * for some reason it is set here to 1514.  I wouldn't change it unless
  394.  * you're sure you won't break something in the kernel. JHH
  395. d185 2
  396. d188 6
  397. a193 2
  398. #define    NET_FDDI_MIN_BYTES    64
  399. #define    NET_FDDI_MAX_BYTES    1514
  400. d196 1
  401. a196 1
  402.  * Definitions of known FDDI packet types (from rfc990, except for SPRITE
  403. d205 1
  404. a205 1
  405. #define NET_FDDI_SPRITE        0x0500
  406. @
  407.